public class Homework {
    public static void main(String[] args) {
        for (int year = 1000; year <= 2000; year++) {
            if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) {
                System.out.println(year);
            }
        }                                     //打印1000-2000之间的所有闰年
    }
}
public class Homework {
    public static void main(String[] args) {
        int count=0;
        for (int i = 1; i <=100 ; i++) {
            if((i%10==9)||(i>=90&&i<=100)){
                count++;
            }                                  //计算1-100之间9出现的次数
        }System.out.println(count);
    }
}
public class Homework {
    public static void main(String[] args) {
        double sum=0;
        double j=0;
        for (int i = 1; i <=100 ; i++) {
            if(i%2!=0){
                j=1.0/i;
            }
            if(i%2==0){
                j=(-1.0/i);
            }
            sum+=j;
        }
        System.out.println(sum);
    }
}
public class Homework {
    public static void main(String[] args) {
        for (int i =100; i <=999 ; i++) {
            int temp=i;
            int j=temp%10;
            temp=temp/10;
            int k=temp%10;                         //打印水仙花数
            temp=temp/10;
            int g=temp%10;
            int sum=(int)(Math.pow(j,3)+Math.pow(k,3)+Math.pow(g,3));
            if(sum==i){
                System.out.println(i);
            }

        }
    }
}